package com.spider.im.common.aspect;

import lombok.Data;

import java.io.Serializable;

/**
 * 封装返回结果
 */
@Data
public class RespResult<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    private int code;
    private String message;
    private T data;

    public static <T> RespResult<T> success(T data) {
        RespResult<T> result = new RespResult<>();
        result.setCode(200);
        result.setMessage("success");
        result.setData(data);
        return result;
    }

    public static <T> RespResult<T> error(int code, String message) {
        RespResult<T> result = new RespResult<>();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

}